//
//  LGSeachBar.m
//  微博
//
//  Created by MS on 15-12-4.
//  Copyright (c) 2015年 MS. All rights reserved.
//

#import "LGSeachBar.h"

@implementation LGSeachBar

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self =[super initWithFrame:frame])
    {
        
        self.font = [UIFont systemFontOfSize:13];
        
        self.background = [UIImage imageResizingWithName:@"searchbar_textfield_background"];
        
        //initWithImage默认设置imageView的frame和图片一样da
        UIImageView * imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"searchbar_textfield_search_icon"]];
      
        imageV.width += 10;
        imageV.contentMode = UIViewContentModeCenter;
        
        self.leftView = imageV;
        
        //一定要设置左边视图模式才能正常显示
        self.leftViewMode = UITextFieldViewModeAlways;
        
    }
    
    return self;
}

@end
